package com.snow.baselibrary.utils;

import android.os.Build;
import android.text.TextUtils;

/**
 * Created by zhaoyingtao
 * Date: 2020/10/15
 * Describe: 判断手机品牌
 */
public class PhoneRomUtil {
    /**
     * 手机品牌
     */
    // 小米
    public static final String PHONE_XIAOMI_1 = "xiaomi";
    public static final String PHONE_XIAOMI_2 = "redmi";
    // 华为
    public static final String PHONE_HUAWEI1 = "huawei";
    // 华为
    public static final String PHONE_HUAWEI2 = "honor";
    // 魅族
    public static final String PHONE_MEIZU = "meizu";
    // 索尼
    public static final String PHONE_SONY = "sony";
    // 三星
    public static final String PHONE_SAMSUNG = "samsung";
    // HTC
    public static final String PHONE_HTC = "htc";
    // OPPO
    public static final String PHONE_OPPO = "oppo";
    // VIVO
    public static final String PHONE_VIVO = "vivo";
    // 乐视===待确认，不知道是不是这个
    public static final String PHONE_LeMobile = "lemobile";
    // 联想
    public static final String PHONE_LENOVO = "lenovo";
    // 诺基亚手机
    public static final String PHONE_NOKIA = "nokia";
    // 一加手机
    public static final String PHONE_ONEPLUS = "oneplus";

    //华为
    public static boolean isHuaWei() {
        return check(PHONE_HUAWEI1) || check(PHONE_HUAWEI2);
    }

    //小米
    public static boolean isXiaoMi() {
        return check(PHONE_XIAOMI_1) || check(PHONE_XIAOMI_2);
    }

    //vivo
    public static boolean isVivo() {
        return check(PHONE_VIVO);
    }

    //oppo
    public static boolean isOppo() {
        return check(PHONE_OPPO);
    }

    //魅族
    public static boolean isMeizu() {
        return check(PHONE_MEIZU);
    }

    //samsung手机
    public static boolean isSamsung() {
        return check(PHONE_SAMSUNG);
    }

    //联想手机
    public static boolean isLenovo() {
        return check(PHONE_LENOVO);
    }

    //诺基亚手机
    public static boolean isNokia() {
        return check(PHONE_NOKIA);
    }

    //一加手机
    public static boolean isOneplus() {
        return check(PHONE_ONEPLUS);
    }

    //HTC手机
    public static boolean isHtc() {
        return check(PHONE_HTC);
    }

    //索尼手机
    public static boolean isSony() {
        return check(PHONE_SONY);
    }

    private static boolean check(String phoneBrand) {
        return !TextUtils.isEmpty(Build.BRAND) && TextUtils.equals(Build.BRAND.toLowerCase(), phoneBrand);
    }
}